package com.hua.struct;

public class ForDemo02 {
    public static void main(String[] args) {
        //计算0到100之间的奇数和偶数的和
        int sum1=0;//奇数和
        int sum2=0;//偶数和

        for (int i = 0; i <= 100; i++) {
            if (i%2==0){
                sum2 = sum2 + i;
            }else {
                sum1 = sum1 + i;
            }
        }
        System.out.println("奇数和为："+sum1);
        System.out.println("偶数和为："+sum2);
    }
}
